import com.mochimedia.ui.*;

/**
* ...
* @author $(DefaultUser)
*/

class com.mochimedia.ui.Divider extends Component {
    
    private var _type:String = "divider";
    
    //
    //
    public function Divider(container:MovieClip, height:Number, position:Position, style:Style) {
        
        init (container, height, position, style);
        
        if (_container != null) create();
        
    }
    
    //
    //
    private function init (container:MovieClip, height:Number, position:Position, style:Style):Void {
        
        super.init(container, position, style);
        
        _width = Math.max(2, Math.floor(_style.borderWidth * 0.5));
		_height = height;
		
		if (_position.placement == Position.PLACEMENT_NORMAL) {
			_position = position.clone( { placement: Position.PLACEMENT_FLOAT, clear: Position.CLEAR_NONE } );
		}
        
    }
    
    //
    //
    public function create ():Void {
        
        super.create();
        
        if (isNaN(_height) || _height == 0) _height = _parentCell.height - _position.margin_top - _position.margin_bottom;

        DrawingMethods.rect(_mc, true, 0, 0, _width / 2, _height, 0x000000, 40);
        DrawingMethods.rect(_mc, false, _width / 2, 0, _width / 2, _height, 0xffffff, 20);
               
    }
    
}